﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ContactRozgarStreet : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        

    }
    protected void BtnSub_ServerClick(object sender, EventArgs e)
    {
        if (txtName.Text != String.Empty && txtEmail.Text != String.Empty && txtSubject.Text != String.Empty && txtMessage.Text != String.Empty)
        {
            SendMail(txtName.Text, txtEmail.Text, txtSubject.Text, txtMessage.Text);
        }
        else
        {
            Response.Write("<script>alert('Please fill all required fields.');</script>");
        }


       
    }

    protected void SendMail(string strName, string strEmail, string sSubjects, string strMessage)
    {
        string MailName = ConfigurationManager.AppSettings["MailName"].ToString();
        string strMailFrom = strEmail;
        string strToMail = "rozgarstreet@gmail.com";
        string strCCMail = "manpower@rozgarstreet.com";
        string strBCCMail = "";
        string strSubject = sSubjects;
        string strMailBody = strMessage;        

        Email objEmail = new Email();
        string Status = objEmail.SendingMail(MailName, strToMail, strMailFrom, strCCMail, strBCCMail, strSubject, strMailBody);
        if (Status != null)
        {
            Response.Write("<script>alert('Mail Send Successfully.');top.location.replace('Default.aspx');</script>");
        }

    }

   
}
